package com.mz.mattress.api.redis;

import com.mz.mattress.api.enums.OrderTagEnum;
import com.mz.mattress.api.enums.SmsEnum;
import com.mz.mattress.api.util.DateUtil;

public class RedisKeys {

    public final static String SMS = "sms:";
    public final static String IMG_CODE = "img_code:";
    //  每日验证码短信数量
    public final static String SMS_VERIFY_COUNT = "sms_verify_count:";
    public final static String SMS_COUNT = "smscnt:";
    public final static String LOCK_MERCHANT = "lock_merchant:";
    public final static String ORDER_LOCK = "order:";
    public final static String HB_LOCK = "hb_lock:";

    public final static String CASHOUT_LOCK = "cashout_lock:";

    public final static String PLAN_TASK_QUEUE = "plan_task_queue";
    public final static String PLAN_TASK_SCORE_QUEUE = "plan_task_score_queue";
    public final static String PLAN_DEVICE_QUEUE = "plan_device_queue";

    public final static String OLD_MOBILE_QUEUE = "old_mobile_queue";
    public final static String CREATE_ORDER_QUEUE = "create_order_queue";

    //复购用户手机号列表
    public final static String BUY_AGAIN_MOBILE_QUEUE = "BUY_AGAIN_MOBILE_QUEUE";

    //核销订单号列表
    public final static String CHECKED_ORDER_ID_QUEUE = "CHECKED_ORDER_ID_QUEUE";


    public static final String getLockMerchantKey(Integer merchantId) {
        return LOCK_MERCHANT + merchantId;
    }

    public static final String getSmsMobileKey(String mobile) {
        return SMS + mobile;
    }

    public static final String getSmsCodeKey(SmsEnum smsEnum, String mobile) {
        return SMS + smsEnum.toString() + ":" + mobile;
    }

    public static final String getPrefixKey(OrderTagEnum tagEnum) {
        String date = DateUtil.getYYMMdd(0);
        String prefix = date + tagEnum.getValue();
        return prefix;
    }

    public static final String getHongBaoKey(String memberId) {
        return HB_LOCK + memberId;
    }

    public static final String getCashOutKey(String cashId) {
        return CASHOUT_LOCK + cashId;
    }

    /**
     * 每日验证码短信数量的key
     */
    public static final String getSmsVerifyCountKey(String mobile) {
        return SMS_VERIFY_COUNT + DateUtil.getNowDate() + ":" + mobile;
    }

    public static final String getSmsCountMobileKey(String mobile) {
        return SMS_COUNT + DateUtil.getNowDate() + ":" + mobile;
    }

    public static final String getOrderKey(String orderId) {
        return ORDER_LOCK + orderId;
    }

    public static final String getImgCodeKey(String uuid) {
        return IMG_CODE + uuid;
    }

//    public static final String getPrefixKey(OrderTagEnum tagEnum) {
//        String date = DateUtil.getYYMMdd(0);
//        String prefix = date + tagEnum.getValue();
//        return prefix;
//    }

    public static void main(String[] args) {
        System.out.println(DateUtil.getYYMMdd(0));
        System.out.println(getSmsVerifyCountKey("15157009867"));

    }
}
